#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/8/13 16:16
# @USER    : Shengji He
# @File    : Subsets.py
# @Software: PyCharm
# @Version  : Python-
# @TASK:
from typing import List


class Solution:
    def subsets(self, nums: List[int]) -> List[List[int]]:
        """
        Given a set of distinct integers, nums, return all possible subsets (the power set).

        Note: The solution set must not contain duplicate subsets.

        Example:
            Input: nums = [1,2,3]
            Output:
                [
                  [3],
                  [1],
                  [2],
                  [1,2,3],
                  [1,3],
                  [2,3],
                  [1,2],
                  []
                ]

        :param nums:
        :return:
        """
        output = [[]]
        for num in nums:
            output += [curr + [num] for curr in output]
        return output


if __name__ == '__main__':
    S = Solution()
    num = [1, 2, 3]
    print(S.subsets(num))
    print('done')
